layui.use(['table','form','laydate','jquery'], function(){
    var table = layui.table;
    var form = layui.form;
    var laydate = layui.laydate;
    var $ = layui.$; //重点处
    //第一个实例
    table.render({
        elem: '#table_list',
        limit: 30,
        method: 'post',
        text: {none: '暂无相关数据'},
        url: '/logic/logic_stock_information/listData', //数据接口
        page: true, //开启分页
        toolbar:"#table_list_tool",
        cols: [[ //表头
            {type:'radio',width:30,fixed: 'left'},
            {field: 'code', title: '股票编码', width:120,align:"center",},
            {field: 'name', title: '股票名称', width:120,align:"center",},
            {field: 'stockExchange', title: '证券交易所', width:120,align:"center",},
            {field: 'currentPrice', title: '当前价格', width:120,align:"center",},
            {field: 'netAssets', title: '每股净资产', width:120,align:"center",},
            {field: 'debtRatio', title: '负债率', width:120,align:"center",},
            {field: 'triggerPrice', title: '上次牛市最大价格', width:120,align:"center",},

        ]],
        parseData: function(result){
            return CommonUtil.layuiParseData(result);
        },
    });

    //搜索初始化
    form.on('submit(search)', function(data){
        //阻止表单跳转。如果需要表单跳转，去掉这段即可。 默认返回 false
        return CommonUtil.layuiInitSearch("table_list",data);
    });

    //工具栏监听事件
    table.on('toolbar(table_list_filter)', function(obj){
        switch(obj.event){
            case 'add': CommonUtil.layuiEditPage("/logic/logic_stock_information/editPage","新增股票信息",500,600,obj); break;
            case 'edit':  CommonUtil.layuiEditPage("/logic/logic_stock_information/editPage","修改股票信息",500,600,obj); break;
            case 'del': CommonUtil.layuiDeleteData("/logic/logic_stock_information/removed","search",obj); break;
        };
    });
});
